package pub.developers.forum.infrastructure.dal.dao;

import org.apache.ibatis.annotations.Param;
import pub.developers.forum.infrastructure.dal.dataobject.CommentDO;

import java.util.Date;
import java.util.List;
import java.util.Set;


public interface CommentDAO {

    CommentDO findByPrimaryKey(@Param("id") Long id);

    List<CommentDO> findByIds(@Param("ids") Set<Long> ids);

    void deleteByUserId(@Param("user_id") Long userId);

    void softDelete(@Param("id") Long id,@Param("update") Date update);

    void insert(CommentDO commentDO);

    void update(CommentDO commentDO);

    List<CommentDO> queryByPostsId(@Param("postsId") Long postsId);

    //查询所有二级评论
    List<CommentDO> queryInReplyIds(@Param("commentIds") List<Long> commentIds);

    //查询二级评论个数
    List<CommentDO> queryInReplyIdsCount(@Param("commentIds") List<Long> commentIds);

    //查询前三条二级评论
    List<CommentDO> queryThreeInReplyIds(@Param("commentIds") List<Long> commentIds);

    List<CommentDO> queryInReplyIdOrReplyReplyId(@Param("id") Long id);

    void deleteByPostsId(@Param("postsId") Long id);

    List<CommentDO> queryInIds(@Param("ids") Set<Long> ids);

    //根据评论id 拿到该评论的点赞次数
    Long getFollowCountById(Long id);

    //评论点赞次数加一或者减一
    /*
    id : 评论id
    newFollowCount : 新的评论点赞次数
     */
    void updateFollowCountAdd(@Param("id") Long id , @Param("followCount") Long newFollowCount);

    Long[] selectCommentIdByUserid(Long userId);
}
